import { useHistory } from 'react-router-dom'
import './index.scss'
export const Listitem = (props) => {
	//跳转路由
	const history = useHistory()
	return (
		<div
			className='map-list'
			onClick={() => {
				history.push({
					pathname: '/detail',
					state: { id: props.houseCode }
				})
			}}
		>
			<img src={props.houseImg} alt='' />
			<div className='list-item'>
				<h3>{props.title}</h3>
				<p>{props.desc}</p>
				<div className='item'>
					{props.tags.map((item, i) => {
						return <span key={i}>{item}</span>
					})}
				</div>
				<div className='price'>
					<h3>{props.price}</h3>
					<span>/1月</span>
				</div>
			</div>
		</div>
	)
}

export default Listitem
